1. Field
The disclosure relates generally to a computer implemented method, a data processing system, and a computer program product for query processing in a relational database. More specifically, the disclosure relates to a computer implemented method, a data processing system, and a computer program product for query routing among a plurality of query processors based on a determined complexity class of the query.
2. Description of the Related Art
Databases are used to store information for an innumerable number of applications, including various commercial, industrial, technical, scientific, and educational applications. As the reliance on information increases, both the volume of information stored in most databases, as well as the number of users wishing to access that information, likewise increases. Moreover, as the volume of information in a database, and the number of users wishing to access the database, increases, the amount of computing resources required to manage such a database increases as well.
Database management systems (DBMS's), which are the computer programs that are used to access the information stored in databases, therefore often require tremendous resources to handle the heavy workloads placed on such systems. As such, significant resources have been devoted to increasing the performance of database management systems with respect to processing searches, or queries, to databases.
Improvements to both computer hardware and software have improved the capacities of conventional database management systems. For example, in the hardware realm, increases in microprocessor performance, coupled with improved memory management systems, have improved the number of queries that a particular microprocessor can perform in a given unit of time. Furthermore, the use of multiple microprocessors and/or multiple networked computers has further increased the capacities of many database management systems.
From a software standpoint, the use of relational databases, which organize information into formally-defined tables consisting of rows and columns, and which are typically accessed using a standardized language such as Structured Query Language (SQL), has substantially improved processing efficiency, as well as substantially simplified the creation, organization, and extension of information within a database.
In a publish-subscribe model, database queries typically return only a subset of the total database entries. The process of selecting messages for reception and processing is called filtering. Database entries are only returned if the attributes or content of those entries match constraints defined by the user in the query. Significant development efforts have been directed toward query optimization, whereby the execution of particular searches, or queries, is optimized in an automated manner to minimize the amount of resources required to execute each query.
Through the incorporation of various hardware and software improvements, many high performance database management systems are able to handle hundreds or even thousands of queries each second, even on databases containing millions or billions of records. However, further increases in information volume and workload are inevitable, so continued advancements in database management systems are still required.
One area that has been a fertile area for academic and corporate research is that of improving the designs of the query optimizers utilized in many conventional database management systems. The primary task of a query optimizer is to choose the most efficient way to execute each database query, or request, passed to the database management system by a user. The output of an optimization process is typically referred to as an “execution plan,” “access plan,” or just “plan” and is frequently depicted as a tree graph. Such a plan typically incorporates (often in a proprietary form unique to each optimizer/DBMS) low-level information telling the database engine that ultimately handles a query precisely what steps to take (and in what order) to execute the query. Also typically associated with each generated plan is an optimizer's estimate of how long it will take to run the query using that plan.
An optimizer's job is often necessary and difficult because of the enormous number (i.e., “countably infinite” number) of possible query forms that can be generated in a database management system, e.g., due to factors such as the use of SQL queries with any number of relational tables made up of countless data columns of various types, the theoretically infinite number of methods of accessing the actual data records from each table referenced (e.g., using an index, a hash table, etc.), and the possible combinations of those methods of access among all the tables referenced, etc. An optimizer is often permitted to rewrite a query (or portion of it) into any equivalent form, and since for any given query there are typically many equivalent forms, an optimizer has a countably infinite universe of extremely diverse possible solutions (plans) to consider. On the other hand, an optimizer is often required to use minimal system resources given the desirability for high throughput. As such, an optimizer often has only a limited amount of time to pare the search space of possible execution plans down to an optimal plan for a particular query.
Another automated tool that is a part of many database management systems is a database monitor. It is used to gather performance statistics related to SQL queries run within the database management system. The data collected by the database monitor is typically collected in a database file itself where it can be queried by a trained user to help identify and tune performance problem areas. A database monitor typically tracks the name of a query, the name of the tables accessed by the query, the indices used by the query (if any), the join parameters of the query, and other pertinent information such as the duration of time the query took to complete. The performance statistics collected by a database monitor are typically large in volume and require a knowledgeable SQL administrator to interpret and use.
Typical query optimizers store information about previously encountered queries and the access plans that were created for such queries. When a previous query is once again encountered, these optimizers use previous access plans to avoid the time and cost of re-creating an access plan regardless of how the earlier access plan performed.
Federated query optimizers often deploy cost-based query optimization mechanisms. Specifically, these optimizers can determine multiple global query execution plans and, then, select the execution plan with the lowest execution cost. Thus, cost functions indirectly influence what remote sources are accessed to retrieve data and how federated queries are processed.